package com.dtagri.fjwlw.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;

import com.dtagri.fjwlw.adapter.viewholders.MenuViewHolder;
import com.dtagri.fjwlw.bean.TjMenu;
import com.dtagri.fjwlw.fragment.ZMenuEnum;

/**
 * @author wxjn
 * 
 */
public class MenuAdapter extends CommonAdapter<TjMenu, MenuViewHolder> {

	public MenuAdapter(Context context, List<TjMenu> mDataSet) {
		super(context, mDataSet);
	}

	@Override
	protected MenuViewHolder createViewHolder() {
		return new MenuViewHolder();
	}

	@Override
	protected void setItemData(int position, MenuViewHolder viewHolder,
			View rootView) {
		TjMenu tjMenu = mDataSet.get(position);
		viewHolder.title.setText(tjMenu.getMenu_key());
		viewHolder.description.setText(tjMenu.getDescription());
		ZMenuEnum pageByTitle = ZMenuEnum.getPageByTitle(tjMenu.getUrl());
		viewHolder.img.setImageResource(pageByTitle.getIcon());
	}

}
